package com.maimao.core.utils;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author MaoLin Wang
 * @date 2021/1/16 10:30 上午
 */
public class BigDecimalUtils {

    public static BigDecimal init(long val, int scale, RoundingMode roundingMode) {
        return new BigDecimal(val).setScale(scale, roundingMode);
    }

    public static BigDecimal defaultRounding(long val, int scale) {
        return new BigDecimal(val).setScale(scale, RoundingMode.HALF_UP);
    }
}
